#ifndef AI_REFLEX_H
#define AI_REFLEX_H



#include "ai.h"
#include <utility>



class reflex_algorithm: public algorithm
{

public:

	reflex_algorithm()
	{
		name = "Reflex algorithm";
	};

	virtual algorithm* clone()
	{
		reflex_algorithm* cl = clonetpl< reflex_algorithm >();
		return cl;
	};

	virtual void get_commands();


private:

	void check_dangerous_places();
	void check_attackable_places();
	std::pair< int, int > find_safe_place( unit* u, game_state* state );
	void find_target_or_move( game_state* state );
	std::pair< int, std::pair< int, int > > find_best_target( game_state* state );
	std::pair< int, int > find_best_target_unit( unit* u, game_state* state );
	bool can_anybody_attack( game_state* state );
	std::pair< int, std::pair< int, int > > find_better_place( game_state* state );
	std::pair < double, std::pair< int, int > > find_better_place_unit( unit* u, game_state* state );
	std::list< std::string > move_commands;
	std::list< std::string > fire_commands;

	int time;
	game_state* state;

};



#endif